package com.zy.cat.entity.game.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.zy.cat.entity.dev.CatDevSignedBeansHistory;
public interface CatDevSignedBeansHistoryRepository extends JpaSpecificationExecutor<CatDevSignedBeansHistory>,  JpaRepository<CatDevSignedBeansHistory, String>{
	public CatDevSignedBeansHistory findByPidAndStime(String pid,String stime);

	/**
	 * 查询翻倍中奖记录
	 */
	public CatDevSignedBeansHistory findByPidAndFid(String pid, String fid);
	
	@Query(nativeQuery = true,value = "SELECT * from zy_cat_user_signed_beans_history where pid=:pid and DATE_FORMAT(stime,'%Y-%m-%d')=CURRENT_DATE order by stime limit 1")
	public CatDevSignedBeansHistory selectLastHistory(@Param("pid") String pid);
}
